-- CAN_SLIME_MONSTER_ATTACK

-- 冈布奥怪能否攻击玩家
-- @param  user     玩家
-- @param  monster  怪物
return function(user, monster)
    -- 1. 怪物已死亡
    if monster:isDead() then
        return "dead";
    end

    -- 2. 怪物被冻结了
    local prop = PropM.combine(monster, "frozen", 1);
    if PropM.apply(prop, 1) > 0 then
        return "frozen";
    end

    -- 3. 怪物被眩晕了
    prop = PropM.combine(monster, "spin", 1);
    if PropM.apply(prop, 1) > 0 then
        return "spin";
    end

    -- 4. 怪物被石化
    prop = PropM.combine(monster, "petrifaction", 1);
    if PropM.apply(prop, 1) > 0 then
        return "petrifaction";
    end

    -- 5. 怪物时间停止中
    prop = PropM.combine(monster, "stop_action", 1);
    if PropM.apply(prop, 1) > 0 then
        return "stop_action";
    end

    -- 6. 怪物被变形了
    if #PropM.fetchProps(monster, "transfiguration") > 0 then
        return "transfiguration";
    end

    -- -- 7. 玩家有不被反击属性
    -- prop = PropM.combine(user, "cant_be_attack", 1);
    -- if DungeonM.getRandSeed("can_be_attack") % 1000 < PropM.apply(prop, 1) then
    --     return "cant_be_attack_" .. prop[3];
    -- end

    -- 8. 怪物被龙威震慑
    prop = PropM.combine(monster, "dragon_majesty", 1);
    if PropM.apply(prop, 1) > 0 then
        return "dragon_majesty";
    end

    return true;
end
